var vm = new Vue({
  el: '#app',
  data(){
    return {  
      form:'',
      formInline:'',
      state:'',
      Class:'',
      stateOptions:'',
      classOptions:'',
      textarea1:''
    };  
  },
  mounted:function ( ) { // 页面加载完成后会调用此函数
    this.$nextTick(function () { // 加个函数可以保证 this和vm是一样 都可以掉用
        vm.management();
    })
  },
  methods:{
		management:function () {
	    this.$http.get('../data.json').then(res => { //作用域指向了外层 里面的this就是外面的this
	      vm.stateOptions = res.body.result.stateOptions;
	      vm.classOptions = res.body.result.classOptions;
	    }); // 调用http方法  
		},
		onSubmit() {
			var accessPro = document.getElementById("accessPro").value;
			var selected = document.getElementById("selected").value;
			var state = document.getElementById("state").value;
			this.$http.post('AccessController/addaccessitem',
			{prame:{access_id:'accessPro',itemname:'selected',itemtype_id:'',itemstate:'state'}}).then(res => { //作用域指向了外层 里面的this就是外面的this
		     
		  }); 
			
      console.log('submit!');
    }
  }
})
